// pages/spring/spring.js
const app = getApp()
const storage = require('../../utils/cache.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    imgUrls: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(){
    this.setData({
      index: 0,
      couplets: app.globalData.gift.couplets,
      
    })
    this.setData({
      imgUrls: this.data.couplets[this.data.index].u,
    })
  },
  make(){
    let data = {
      url: this.data.imgUrls
    }
    storage.put('one',data)
    wx.navigateTo({
      url: '../firework/firework',
    })
  },
  change() {
    ++this.data.index
    if (this.data.index === this.data.couplets.length) {
      this.data.index = 0
      this.setData({
        imgUrls: this.data.couplets[this.data.index].u
      })
    } else {
      this.setData({
        imgUrls: this.data.couplets[this.data.index].u
      })
    }
  },
  onShareAppMessage() {
    return {
      title: '一起来制作2019新年大礼包~',
      path: '/pages/home/home',
      imageUrl: '../../img/share.png',
    }
  },
})